/**
 * 客户修改s
 */
var comValidform=null;
var returnStatus=false;
var customerUpdate={
	dataCache:null,
		
	startEvent:function(){
		customerUpdate.showInfoById();
		
		comValidform=$(".com-addForm").Validform({
			tiptype:2,
			tipSweep:true,
			beforeSubmit:function(curform){
				var url = 'mgr/CustomerCtrl/updateCustomer';
				var params = jsUtils.serializeJson($('.com-addForm'));
				var cb = function(data){
					alert(data.msg);
					//成功返回
					if(data.resultCode==1){
						//关闭窗口并刷新数据
						art.dialog.close();
						returnStatus=true;
					}
				};
				//sendApiNoLoadSync(url, params, cb, 'POST');
				return false;
			}
		});
	},
	
	showInfoById:function(){
		var updId=art.dialog.data('updId');  //修改id
		var url = 'mgr/CustomerCtrl/getCustomerById';
		var params ={
				'id':updId
		};
		var cb = function(data){
			if(data.resultCode==1){
				var ret=data.result;
				for(var i in ret){
					var text=ret[i];
					$('#com-addForm input[name="'+i+'"]').val(text);
				}
			}
		};
		sendApiNoLoad(url, params, cb, 'POST');
	},
	
	init:function(){
		customerUpdate.startEvent();
	}
}
$(document).ready(function() {
	customerUpdate.init();
});
function submitForm(){
	comValidform.submitForm();
	return returnStatus;
}